thin.imports('/public/configure/conf.project.js');
thin.imports('/public/plug/laytpl/laytpl.js');
thin.imports('/public/plug/LoadEffect/LoadEffect.js');

thin.use(function() {
	// 頁面加載完畢
	thin.effect();
	
	layer.load(0, {
		shade: [0.08, '#000']
	});
	__getdata_prome['model'] = 0;
	factory.request('_project_me');
	
	// 绑定项目未评估按钮
	$('#prolist-w').on('click', 'a', function() {
		window.location.href = '/project/cp.html';
	});
	// 绑定项目已评估按钮
	$('#prolist-y').on('click', 'a', function() {
		window.location.href = '/project.html';
	});
	
});

var __getdata_prome = {};

// 获取项目回调
function __complete_prome(res) {
	layer.closeAll('loading');
	if(res.status == 200) {
		createProjectList(res.data);
	} else {
		layer.msg(res.error, {
			icon: 2,
			time: 800
		});
	}
}

function createProjectList(data) {
	var is_on = 0,
		is_off = 0;
	for(var i in data) {
		var list = data[i];
		var ele = '';
		ele += '<div class="p-cls b-line-b clearfix" data-id="p-cls0">';
		ele += '<img src="' + list.logo + '" class="pic-circle float-left" />';
		ele += '<span class="p-cls-cont">';
		ele += '<p>' + list.title + '</p>';
		ele += '<p>' + list.words + '</p>';
		ele += '</span>';
		ele += '<div class="box-buttom">';
		ele += '<a href="javascript:;" class="submit-buttom btn-seldata" >' + (list.is_cp == 0 ? '项目估值' : '一键融资') + '</a>';
		ele += '</div>';
		ele += '</div>';
		if (list.is_cp == 0) {
			// 未评估
			$('#prolist-w').find('#project-volist').append(ele);
			is_off++;
		} else {
			// 已评估
			$('#prolist-y').find('#project-volist').append(ele);
			is_on++;
		}
	}
	$('#prolist-w').show();
	$('#prolist-y').show();
	if (is_off > 0) {
		$('#prolist-w').find('.nothing-box').hide();
	} else {
		$('#prolist-w').find('.nothing-box').show();
	}
	if (is_on > 0) {
		$('#prolist-y').find('.nothing-box').hide();
	} else {
		$('#prolist-y').find('.nothing-box').show();
	}
}